package com.zwp.base.ext

import android.widget.RadioButton
import android.widget.RadioGroup
import androidx.databinding.BindingAdapter
import com.zwp.base.binding.BindingCommand


@BindingAdapter(value = ["onCheckedChangedCommand"])
fun onCheckedChangedCommand(radioGroup: RadioGroup, bindingCommand: BindingCommand<String>) {
    radioGroup.setOnCheckedChangeListener { radioGroup, i ->
        val radioButton = radioGroup.findViewById<RadioButton>(i)
        bindingCommand.execute(radioButton.text.toString())
    }
}